From 6108c646c57c6c489225f5e5e6484ac282c07bdf Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 26 Feb 2016 14:48:21 -0500 Subject: [PATCH] cssselector: Don't invoke undefined behavior Avoid undefined behavior in the calculation of some hash values. Found by gcc's undefined behavior sanitizer. --- gtk/gtkcssselector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/gtkcssselector.c b/gtk/gtkcssselector.c index f0e91b2a5c..9309de5d6f 100644 --- a/gtk/gtkcssselector.c +++ b/gtk/gtkcssselector.c @@ -842,7 +842,7 @@ match_pseudoclass_position (const GtkCssSelector *selector, static guint hash_pseudoclass_position (const GtkCssSelector *a) { - return (((a->position.type << POSITION_NUMBER_BITS) | a->position.a) << POSITION_NUMBER_BITS) | a->position.b; + return (guint)(((((gulong)a->position.type) << POSITION_NUMBER_BITS) | a->position.a) << POSITION_NUMBER_BITS) | a->position.b; } static int -- 2.30.2